package demo1;

public class Testdemo {
    public static void eatfunc(Animal animal){
        animal.eat();
    }
    public static void main(String[] args) {
        Bird bird = new Bird(2,"金丝雀");
        eatfunc(bird);

        Dog dog = new Dog(5,"斯派克");
        eatfunc(dog);
        System.out.println(bird);
        System.out.println(dog);
    }
    public static void main1(String[] args) {
/*        Animal animal= new Dog(6,"小黑");
        animal.eat();
        System.out.println(animal);*/

        Animal animal1 = new Dog(5,"旺财");
        Bird bird1 = (Bird)animal1;
        bird1.fly();


    }
}
